/* 
 * File:   chessboard.h
 * Author: xjohnx
 *
 * Created on September 25, 2011, 6:07 PM
 */

#ifndef CHESSBOARD_H
#define	CHESSBOARD_H

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <sstream>


#include "Coordinate.h"

using namespace std;



class Chessboard {
public:
    Chessboard(int width, int height);
    Chessboard(int width, int height, int * coordinates, int q);
    virtual ~Chessboard();
    int getSize() const;
    int getOnLightsCount() const;
    int getWidth() const {return m_width;}
    int getHeight() const {return m_height;}
    /**
     * Switch the light on Coordinates c and lights in its neighbourhoods
     * @param c Coordinates of the light to be switched
     */
    void pressLight(int x, int y);
//    void pressLight(int fieldNumber);
private:
    void init(int width, int height);
   /**
    * Switch the state of single light
    * @param x x coordinate of the light
    * @param y y coordinate of the light
    */
    void switchState(int x, int y);
    
    /**
     * Returns the field on specific coordinates
     */
    bool* getField(int x, int y);
    
    void verifyCoords(int x, int y) const;
    
    bool* m_data;
    int m_width;
    int m_height;
    int m_onLightsCount;
};

#endif	/* CHESSBOARD_H */
